﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Net_SCADA
{
    public class KeyTime
    {
        public string[] KeyTimeName { get; set; }
        public DateTime MoveInTime { get; set; }
        public DateTime MoveOutTime { get; set; }
        public List<int[]> ZoneID { get; set; } =new List<int[]>();
        public int KeyTimeInIndex { get; set; }//从0开始
        public int KeyTimeOutIndex { get; set; }
        //查询的时候就按照相关index在数据库里面进行数据的获取 keytime0~keytime40

        public void SetZoneID(string ids)
        {
            if (ids.Length > 0)
            {
                string[] s=ids.Split(new char[]{','},StringSplitOptions.RemoveEmptyEntries);
                int x=0;
                DataTable dt=null;
                for (int i = 0 ; i < s.Length ; i++)
                {
                    ZoneID.Add(new int[2]);
                    dt = DBOperate.GetZoneSet(s[i]);
                    if(dt!=null && dt.Rows.Count > 0)
                    {
                        int.TryParse(dt.Rows[0]["pvid"].ToString() , out x);
                        ZoneID.Last()[0] = x;
                        int.TryParse(dt.Rows[0]["svid"].ToString() , out x);
                        ZoneID.Last()[1] = x;
                    }
                }
            }
        }
    }
}
